package com.test.test.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.test.test.service.PayService;

@RestController
public class PayController {
	
	
	@Autowired
	PayService payService;
	
	 
	@GetMapping("pay/{productId}")
	public String pay(@PathVariable("productId") String productId) throws Exception {
		payService.pay(productId);
		return payService.paySelect(productId);
	}

	@GetMapping("/paySelect/{productId}")
	public String paySelect(@PathVariable("productId") String productId) {
		return payService.paySelect(productId);
	}

	@GetMapping("payProduct/{productId}")
	public String payDataStoc(@PathVariable("productId") String productId) throws Exception {
		payService.killProduct(productId);
		return payService.selectProduct(productId);
	}
	
	@GetMapping("payProduct1/{productId}")
	public String payDataStoc1(@PathVariable("productId") String productId) throws Exception {
		payService.killProductMapper(productId);
		return payService.selectProduct(productId);
	}
	@GetMapping("/payData/{productId}")
	public String payData(@PathVariable("productId") String productId) throws Exception {
		return payService.selectProduct(productId);
	}
}
